package cn.ainit.fx;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import cn.ainit.sys.framework.FrameworkDao;
import cn.ainit.sys.query.datastore.DataStore;
import cn.ainit.sys.query.entity.QueryJson;
import org.springframework.stereotype.Service;

@Service
public class FaxingServiceImpl implements FaxingService{
	
	FaxingDao faxingDao;
	
	public FaxingDao getFaxingDao() {
		return faxingDao;
	}
	
	@Resource
	public void setFaxingDao(FaxingDao faxingDao) {
		this.faxingDao = faxingDao;
	}

	/**
	 * 获取征订单的折扣
	 */
	@Override
	public Map<String, Object> getDiscount(List<String> keyVal,
			HttpServletRequest request, HttpSession session) throws Exception{
		return faxingDao.getDiscount(keyVal,request,session);
	}

	@Override
	public List execSql(String sql) throws Exception {
		return this.faxingDao.execSql(sql);
	}
	@Override
	public Double execFuncDZ(String clientId) throws Exception {
		return this.faxingDao.execFuncDZ(clientId);
	}
	@Override
	public Double execYSFunc(String clientId) throws Exception {
		return this.faxingDao.execYSFunc(clientId);
	}
	@Override
	public Double execSKCYFunc(String clientId) throws Exception {
		return this.faxingDao.execSKCYFunc(clientId);
	}
	@Override
	public Double execZQKFunc(String clientId) throws Exception {
		return this.faxingDao.execZQKFunc(clientId);
	}
	
	@Override
	public Map<String, Object> getStockNumByHidStock(List<String> keyVal,
			HttpServletRequest request, HttpSession session) throws Exception {
		return faxingDao.getStockNumByHidStock(keyVal,request,session);
	}

	
	@Override
	public boolean saveSamples(SamplingList samples) throws Exception {
		return  faxingDao.saveSamples(samples);
	}
	
	@Override
	public SamplingList addSamples(SamplingList samples) throws Exception {
		return faxingDao.addSamples(samples);
	}
	
	@Override
	public boolean addSamplesCount(SamplingList samples) throws Exception {
		return  faxingDao.addSamplesCount(samples);
	}
	
	@Override
	public SamplingList getSamples(String oid) throws Exception {
		return faxingDao.getSamples(oid);
	}
	@Override
	public boolean saveDZYSFunc(String jsId,String cid,List<Map<String, String>> ysData,String manId)
			throws Exception {
		return faxingDao.saveDZYSFunc(jsId,cid, ysData, manId);
	}
	@Override
	public boolean saveSKDKFunc(String skId,String cid,List<Map<String, String>> ysData,
			String manId) throws Exception {
		return faxingDao.saveSKDKFunc(skId,cid,ysData,manId);
	}
	@Override
	public List getDzysByJsId(String jsId) throws Exception {
		return this.faxingDao.getDzysByJsId(jsId);
	}

	@Override
	public List DKMByClient(String clientId) throws Exception {
		return this.faxingDao.DKMByClient(clientId);
	}
	@Override
	public List getDkskBySkId(String skId) throws Exception {
		return this.faxingDao.getDkskBySkId(skId);
	}
	@Override
	public List getDzItemByJSId(String jsId,String flag) throws Exception {
		return this.faxingDao.getDzItemByJSId(jsId,flag);
	}
	//根据客户Id查找客户送货地址的数量
	@Override
	public Integer findCountByCId(String cid) throws Exception {
		return this.faxingDao.findCountByCId(cid);
	}
	@Override
	public String findShelfId(String stockId, String hId) throws Exception {
		return this.faxingDao.findShelfId(stockId, hId);
	}
	@Override
	public String getAmountByHid(String hId) throws Exception {
		return this.faxingDao.getAmountByHid(hId);
	}
	
	@Override
	public String findAdress(String clientId) throws Exception {
		return this.faxingDao.findAdress(clientId);
	}
	@Override
	public String findStockId(String peItemId) throws Exception {
		return this.faxingDao.findStockId(peItemId);
	}
	@Override
	public int execSqlToInt(String sql) throws Exception {
		return this.faxingDao.execSqlToInt(sql);
	}
	@Override
	public String zqByClientId(String clientId) throws Exception {
		return this.faxingDao.zqByClientId(clientId);
	}

	@Override
	public List listByClientId(String clientId) throws Exception {
		return this.faxingDao.listByClientId(clientId);
	}
	@Override
	public List listByoid(String oIdLastgr,String hid) throws Exception {
		return this.faxingDao.listByoid(oIdLastgr,hid);
	}
	@Override
	public int pdCountByKPId(String kpId) throws Exception {
		return this.faxingDao.pdCountByKPId(kpId);
	}
	@Override
	public String wyVerifyYW(List<String> runIds,String manId) throws Exception {
		return this.faxingDao.wyVerifyYW(runIds,manId);
	}
	@Override
	public String wyVerifyDeap(List<String> runIds,String manId) throws Exception {
		return this.faxingDao.wyVerifyDeap(runIds,manId);
	}
	@Override
	public String gscalCulaButn(List<String> runIds,String manId) throws Exception {
		return this.faxingDao.gscalCulaButn(runIds,manId);
	}
	@Override
	public String amountUnitPrice(List<String> runIds,String manId) throws Exception {
		return this.faxingDao.amountUnitPrice(runIds,manId);
	}
	@Override
	public boolean bmSaveFunc(List<Map<String, String>> allRows)
			throws Exception {
		return this.faxingDao.bmSaveFunc(allRows);
	}
	@Override
	public String sureFH(String manId,String runids) throws Exception {
		return this.faxingDao.sureFH(manId,runids);
	}
	@Override
	public boolean qxDeapVerifyFunc(List<String> runIds) throws Exception {
		return this.faxingDao.qxDeapVerifyFunc(runIds);
	}
	@Override
	public boolean qxYwFH(String runIds) throws Exception {
		return this.faxingDao.qxYwFH(runIds);
	}
	@Override
	public boolean sureKP(String kpId) throws Exception {
		return this.faxingDao.sureKP(kpId);
	}
	
	@Override
	public boolean kpsqzt(String kpId) throws Exception {
		return this.faxingDao.kpsqzt(kpId);
	}
	@Override
	public String dkToYSFunc(String djId,String manId) throws Exception {
		return this.faxingDao.dkToYSFunc(djId,manId);
	}
	@Override
	public List getCJxtByXtId(String xtId) throws Exception {
		return this.faxingDao.getCJxtByXtId(xtId);
	}
	@Override
	public List getTempData() throws Exception {
		return this.faxingDao.getTempData();
	}
	
	@Override
	public List findYsData(String skId,String clientId) throws Exception {
		return this.faxingDao.findYsData(skId,clientId);
	}
	@Override
	public List findZcYsData(String VENDORID) throws Exception {
		return this.faxingDao.findZcYsData(VENDORID);
	}
	@Override
	public List findDkData(String skId,String clientId) throws Exception {
		return this.faxingDao.findDkData(skId,clientId);
	}
	@Override
	public boolean saveXSXTFunc(String xtId, List<Map<String, String>> xtData,
			String manId,String clientId) throws Exception {
		return this.faxingDao.saveXSXTFunc(xtId, xtData, manId,clientId);
	}
	@Override  
	public boolean saveTempDataFunc(List<Map<String, String>> selRows)
			throws Exception {
		return this.faxingDao.saveTempDataFunc(selRows);
	}
	
	@Override  
	public boolean saveCacheYS(List<Map<String, String>> selRows,String skid)
			throws Exception {
		return this.faxingDao.saveCacheYS(selRows,skid);
	}
	@Override  
	public boolean saveCacheDK(List<Map<String, String>> selRows,String skid)
			throws Exception {
		return this.faxingDao.saveCacheDK(selRows,skid);
	}
	@Override
	public boolean delTemoDataFunc(List<Map<String, String>> delRows)
			throws Exception {
		return this.faxingDao.delTemoDataFunc(delRows);
	}
	@Override
	public boolean execSqlB(String sql) throws Exception {
		return this.faxingDao.execSqlB(sql);
	}
	@Override
	public List moreAddByCId(String clientId) throws Exception {
		return this.faxingDao.moreAddByCId(clientId);
	}
	
	/********************************************
	 * 客户添货拉去员工地址
	 * @param cId
	 * @return
	 * @throws 王康
	 *****************************************/
	@Override
	public List getAddressGoodsByCId(String cId) throws Exception {
		return this.faxingDao.getAddressGoodsByCId(cId);
	}
	
	/***
	 * 银行到款，客户客户账户回车事件，返回客户名称
	 * @param cId
	 * @return
	 * @throws 王康
	 ****/
	@Override
	public List getDkAccountByClient(String bankaccount) throws Exception {
		return this.faxingDao.getDkAccountByClient(bankaccount);
	}
	
	/**
	 * 客户收款，金额清除方法
	 */
	@Override
	public String removemoney(String chid) throws Exception {
		return this.faxingDao.removemoney(chid);
	}
	
	/**
	 * 客户预收，金额清除方法
	 */
	@Override
	public String cjbremovemoney(String chid) throws Exception {
		return this.faxingDao.cjbremovemoney(chid);
	}
	
	@Override
	public List CountPackNum(String hid,String amount) throws Exception{
		return this.faxingDao.CountPackNum(hid,amount);
	}
	
	@Override
	public String getXtDiscount(String cid, String hId) throws Exception {
		return this.faxingDao.getXtDiscount(cid, hId);
	}

	@Override
	public String yfdSaveBefore(List<Map<String, Object>> allRows,
			HttpServletRequest request, HttpSession session) {
		// TODO Auto-generated method stub
		return this.faxingDao.yfdSaveBefore(allRows, request, session);
	}

	@Override
	public String clientsureFH(String manId, String runids) throws Exception {
		// TODO Auto-generated method stub
		return this.faxingDao.clientsureFH(manId,runids);
	}
	@Override
	public List getcontractnobyzcid(String mb) {
		// TODO Auto-generated method stub
		return faxingDao.getcontractnobyzcid(mb);
	}

    /**
     * 出版社预收，金额清除方法
     */
    @Override
    public String cbsremovemoney(String chid) throws Exception {
        return this.faxingDao.cbsremovemoney(chid);
    }
    /**
     * 出版社保存的方法saveDZYSFunc
     */
    @Override
    public boolean saveCBSDZYSFunc(String skId,String YSID,String PUB_ID,List<Map<String, String>> ysData,String manId)
            throws Exception {
        return faxingDao.saveCBSDZYSFunc(skId,YSID,PUB_ID, ysData, manId);
    }


    @Override
    public List getcontractnobycbsid(String mb) {
        // TODO Auto-generated method stub
        return faxingDao.getcontractnobycbsid(mb);
    }


    public List getcontractnobyfkdxid(String VENDOR_ID){
        return faxingDao.getcontractnobyfkdxid(VENDOR_ID);
    }

    public List getcontractnobyzzfkdxid(String VENDOR_ID){
        return faxingDao.getcontractnobyzzfkdxid(VENDOR_ID);
    }

	public List getcontractnobyzzfkdxid(String VENDOR_ID, String AUTHOR){
		return faxingDao.getcontractnobyzzfkdxid(null, null, null, null, VENDOR_ID, AUTHOR);
	}

	public List getcontractnobyzzfkdxid(String hxdId, Date begin, Date end, String XT_ID, String VENDOR_ID, String AUTHOR){
		return faxingDao.getcontractnobyzzfkdxid(hxdId, begin, end, XT_ID, VENDOR_ID, AUTHOR);
	}

    @Override
    public boolean saveCacheYF(List<Map<String, String>> selRows,String skid)
            throws Exception {
        return this.faxingDao.saveCacheYF(selRows, skid);
    }

    @Override
    public List findYFData(String skId,String clientId) throws Exception {
        return this.faxingDao.findYFData(skId,clientId);
    }

    public double getzzyfdSum_yfmoney(String JIAFANG ) throws Exception{
        return this.faxingDao.getzzyfdSum_yfmoney(JIAFANG);
    }

    @Override
    public double saveYFFunc(String skId,String cid,String djcode,List<Map<String, String>> ysData,
                                String manId) throws Exception {
        return faxingDao.saveYFFunc(skId,cid,djcode,ysData,manId);
    }

    /**
     * 使用预付，金额清除方法
     */
    @Override
    public String zzhxdremovemoney(String djcode) throws Exception {
        return this.faxingDao.zzhxdremovemoney(djcode);
    }

    @Override
    public int selremove(String djcode,String YF_ID) throws Exception {
        return this.faxingDao.selremove(djcode, YF_ID);
    }

    /**
     * 费用报销预收，金额清除方法
     */
    @Override
    public String bxfyremovemoney(String chid) throws Exception {
        return this.faxingDao.bxfyremovemoney(chid);
    }
    /**
     * 报销费用保存的方法saveBxfyYSFunc
     */
    @Override
    public boolean saveBxfyYSFunc(String skId,String YSID,String XT_ID,List<Map<String, String>> ysData,String manId)
            throws Exception {
        return faxingDao.saveBxfyYSFunc(skId,YSID,XT_ID, ysData, manId);
    }

    public int getYINSHUsum(String VENDOR_ID,String YINCI) throws Exception{
        return faxingDao.getYINSHUsum(VENDOR_ID,YINCI);
    }

    public List getcontractnobyxtid(String VENDOR_ID){
        return faxingDao.getcontractnobyxtid(VENDOR_ID);
    }

    /**
     *  (客户回款计划)
     * @param VENDOR_ID    片区经理
     * @param request
     * @return
     */
    public List getcontractnobykhhkjh(String VENDOR_ID,String KH_DATE) throws Exception{
        return faxingDao.getcontractnobykhhkjh(VENDOR_ID,KH_DATE);
    }

    /**
     *  客户实销上报统计（按日）
     *  ,String data2,String data3
     *  ,data2,data3
     * @return
     */
    @Override
    public QueryJson loadclientbyData(String dsId,String date1) throws Exception{
        DataStore dataStore= faxingDao.getDataStoreById(dsId);
        DataStore dataStoreTotal=faxingDao.getDataStoreById(dsId+"_total");
        return this.faxingDao.loadclientbyData(dataStore, dataStoreTotal, date1);
    }


    @Override
    public List getfindbxData(String bxId) throws Exception {
        return this.faxingDao.getfindbxData(bxId);
    }
}
